package com.tamecode.context;

import com.tamecode.reflect.Car;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericGroovyApplicationContext;

/**
 * @Author: LiQiongchao
 * @Date: 2021/8/5 21:37
 */
public class GroovyApplicationContextTest {

    @Test
    public void getBean() {
        ApplicationContext context = new GenericGroovyApplicationContext("classpath:com/tamecode/context/groovyBeans.groovy");
        Car car = (Car) context.getBean("car");
        Assert.assertNotNull(car);
        Assert.assertEquals(car.getColor(), "red");
    }

}
